﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Pap.Data.Abstraction.Utils
{
    /// <summary>
    /// 
    /// </summary>
    public interface IDatabase : IDisposable, ISubmitChanges
    {
        /// <summary>
        /// Gets the users.
        /// </summary>
        IQueryable<IUser> Users { get; }
        ///<summary>
        /// Get the user Roles
        ///</summary>
        IQueryable<IUsersRole> UsersRole { get; }
        /// <summary>
        /// Gets the users Projects.
        /// </summary>
        IQueryable<IUsersProject> UsersProjects { get; }
        /// <summary>
        /// Gets the roles.
        /// </summary>
        IQueryable<IRole> Roles { get; }
        ///<summary>
        /// Get the Role Permissions
        ///</summary>
        IQueryable<IRolesPermission> RolesPermission { get; }
        /// <summary>
        /// Gets the permissions.
        /// </summary>
        IQueryable<IPermission> Permissions { get; }
        /// <summary>
        /// Gets the villages.
        /// </summary>
        IQueryable<IVillage> Villages { get; }
        /// <summary>
        /// Gets the committees.
        /// </summary>
        IQueryable<ICommittee> Committees { get; }
        /// <summary>
        /// Gets the committees URL.
        /// </summary>
        IQueryable<ICommitteesURL> CommitteesURL { get; }
        /// <summary>
        /// Gets the settings.
        /// </summary>
        IQueryable<ISetting> Settings { get; }
        /// <summary>
        /// Gets the centers.
        /// </summary>
        IQueryable<ICenter> Centers { get; }
        /// <summary>
        /// Gets the projects.
        /// </summary>
        IQueryable<IProject> Projects { get; }
        /// <summary>
        /// Gets the project stages.
        /// </summary>
        IQueryable<IProjectStage> ProjectStages { get; }
        /// <summary>
        /// Gets the customers.
        /// </summary>
        IQueryable<ICustomer> Customers { get; }
        /// <summary>
        /// Gets the customer loans.
        /// </summary>
        IQueryable<ICustomerLoan> CustomerLoans { get; }
        /// <summary>
        /// Gets the images.
        /// </summary>
        IQueryable<IImage> Images { get; }
        /// <summary>
        /// Gets the image types.
        /// </summary>
        IQueryable<ILookUpEntity> ImageTypes { get; }
        /// <summary>
        /// Gets the issue places.
        /// </summary>
        IQueryable<IIssuePlace> IssuePlaces { get; }
        /// <summary>
        /// Gets the customer loan histories.
        /// </summary>
        IQueryable<ICustomerLoanHistory> CustomerLoanHistories { get; }
        /// <summary>
        /// Gets the loan feasibility studies.
        /// </summary>
        IQueryable<ILoanFeasibilityStudy> LoanFeasibilityStudies { get; }
        /// <summary>
        /// Gets the boards.
        /// </summary>
        IQueryable<IBoard> Boards { get; }
        /// <summary>
        /// Gets the board loans.
        /// </summary>
        IQueryable<IBoardLoan> BoardLoans { get; }
        /// <summary>
        /// Gets the board attendees.
        /// </summary>
        IQueryable<IBoardAttendee> BoardAttendees { get; }
        /// <summary>
        /// Gets the loan feasibility study attachments.
        /// </summary>
        IQueryable<ILoanFeasibilityStudyAttachment> LoanFeasibilityStudyAttachments { get; }
        /// <summary>
        /// Gets the loan social researches.
        /// </summary>
        IQueryable<ILoanSocialResearch> LoanSocialResearches { get; }
        /// <summary>
        /// Gets the loan social research attachments.
        /// </summary>
        IQueryable<ILoanSocialResearchAttachment> LoanSocialResearchAttachments { get; }
        /// <summary>
        /// Gets the user messages.
        /// </summary>
        IQueryable<IUserMessage> UserMessages { get; }
        /// <summary>
        /// Gets the board attachments.
        /// </summary>
        IQueryable<IBoardAttachment> BoardAttachments { get; }
        /// <summary>
        /// Gets the receipts.
        /// </summary>
        IQueryable<IReceipt> Receipts { get; }
        /// <summary>
        /// Gets the loan executions.
        /// </summary>
        IQueryable<ILoanExecution> LoanExecutions { get; }
        /// <summary>
        /// Gets the loan executions attachmens.
        /// </summary>
        IQueryable<ILoanExecutionAttachment> LoanExecutionsAttachmens { get; }
        /// <summary>
        /// Gets the loan execution installments.
        /// </summary>
        IQueryable<ILoanExecutionInstallment> LoanExecutionInstallments { get; }
        /// <summary>
        /// Gets the loan installment payments.
        /// </summary>
        IQueryable<ILoanInstallmentPayment> LoanInstallmentPayments { get; }
        /// <summary>
        /// Gets the committee bank accounts.
        /// </summary>
        IQueryable<ICommitteeBankAccount> CommitteeBankAccounts { get; }
        /// <summary>
        /// Gets the committee bank account deposites.
        /// </summary>
        IQueryable<ICommitteeBankAccountDeposite> CommitteeBankAccountDeposites { get; }
        /// <summary>
        /// Gets the committee bank account deposit attachments.
        /// </summary>
        IQueryable<ICommitteeBankAccountDepositAttachment> CommitteeBankAccountDepositAttachments { get; }
        /// <summary>
        /// Gets the committee bank account deposit receipts.
        /// </summary>
        IQueryable<ICommitteeBankAccountDepositReceipt> CommitteeBankAccountDepositReceipts { get; }
        /// <summary>
        /// Gets the committee bank account expenses.
        /// </summary>
        IQueryable<ICommitteeBankAccountExpense> CommitteeBankAccountExpenses { get; }
        /// <summary>
        /// Gets the committee bank account main branch deposit attachments.
        /// </summary>
        IQueryable<ICommitteeBankAccountMainBranchDepositAttachment> CommitteeBankAccountMainBranchDepositAttachments { get; }
        /// <summary>
        /// Gets the committee bank account main branch deposites.
        /// </summary>
        IQueryable<ICommitteeBankAccountMainBranchDeposite> CommitteeBankAccountMainBranchDeposites { get; }
        /// <summary>
        /// Gets the loan installment warnings.
        /// </summary>
        IQueryable<ILoanInstallmentWarning> LoanInstallmentWarnings { get; }
        /// <summary>
        /// Gets the loan installment warning attachments.
        /// </summary>
        IQueryable<ILoanInstallmentWarningAttachment> LoanInstallmentWarningAttachments { get; }
        /// <summary>
        /// Gets the loan cases.
        /// </summary>
        IQueryable<ILoanCase> LoanCases { get; }
        /// <summary>
        /// Gets the loan cancelling debts.
        /// </summary>
        IQueryable<ILoanCancellingDebt> LoanCancellingDebts { get; }
        /// <summary>
        /// Gets the loan cancelling debt attachments.
        /// </summary>
        IQueryable<ILoanCancellingDebtAttachment> LoanCancellingDebtAttachments { get; }
        /// <summary>
        /// Gets the main committee deposits.
        /// </summary>
        IQueryable<IMainCommitteeDeposit> MainCommitteeDeposits { get; }
        /// <summary>
        /// Gets the main committee expenses.
        /// </summary>
        IQueryable<IMainCommitteeExpense> MainCommitteeExpenses { get; }
        /// <summary>
        /// Gets the board members.
        /// </summary>
        IQueryable<IBoardMember> BoardMembers { get; }
        #region Lookups

        /// <summary>
        /// Gets the governorates.
        /// </summary>
        IQueryable<IGovernorate> Governorates { get; }
        /// <summary>
        /// Gets the social statuses.
        /// </summary>
        IQueryable<ILookUpEntity> SocialStatuses { get; }
        /// <summary>
        /// Gets the educational levels.
        /// </summary>
        IQueryable<ILookUpEntity> EducationalLevels { get; }
        /// <summary>
        /// Gets the loan place types.
        /// </summary>
        IQueryable<ILookUpEntity> LoanPlaceTypes { get; }
        /// <summary>
        /// Gets the loan types.
        /// </summary>
        IQueryable<ILookUpEntity> LoanTypes { get; }
        /// <summary>
        /// Gets the loan payment method.
        /// </summary>
        IQueryable<ILoanPaymentMethod> LoanPaymentMethod { get; }
        /// <summary>
        /// Gets the military statuses.
        /// </summary>
        IQueryable<ILookUpEntity> MilitaryStatuses { get; }
        /// <summary>
        /// Gets the loan legal forms.
        /// </summary>
        IQueryable<ILookUpEntity> LoanLegalForms { get; }
        /// <summary>
        /// Gets the type of the loan history close.
        /// </summary>
        /// <value>
        /// The type of the loan history close.
        /// </value>
        IQueryable<ILookUpEntity> LoanHistoryCloseType { get; }
        #endregion

        #region ReportsViews

        /// <summary>
        /// Gets the V users transactions.
        /// </summary>
        IQueryable<IVUsersTransaction> VUsersTransactions { get; }
        /// <summary>
        /// Gets the V monthly accountant report.
        /// </summary>
        IQueryable<IVMonthlyAccountantReport> VMonthlyAccountantReport { get; }
        /// <summary>
        /// Gets the V monthly responsible report.
        /// </summary>
        IQueryable<IVMonthlyResponsibleReport> VMonthlyResponsibleReport { get; }
        /// <summary>
        /// Gets the V waiting list report.
        /// </summary>
        IQueryable<IVWaitingListReport> VWaitingListReport { get; }
        /// <summary>
        /// Gets the V total system report.
        /// </summary>
        IQueryable<IVTotalSystemReport> VTotalSystemReport { get; }
        #endregion

        /// <summary>
        /// Deletes the specified entity.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <param name="entity">The entity.</param>
        void Delete<TEntity>(TEntity entity) where TEntity : IEntity;
        /// <summary>
        /// Deletes all.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <param name="entities">The entities.</param>
        void DeleteAll<TEntity>(IEnumerable<TEntity> entities) where TEntity : IEntity;

        /// <summary>
        /// Inserts the specified entity.
        /// </summary>
        /// <typeparam name="TEnity">The type of the enity.</typeparam>
        /// <param name="entity">The entity.</param>
        void Insert<TEnity>(TEnity entity) where TEnity : IEntity;
        /// <summary>
        /// Inserts all.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <param name="entities">The entities.</param>
        void InsertAll<TEntity>(IEnumerable<TEntity> entities) where TEntity : IEntity;
    }
}
